package com.hspedu.newData.dmsxl.双指针;

import org.junit.Test;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-04-27 
 * @Version: 1.0
 */

public class LC11盛最多水的容器 {

    public int maxArea(int[] height) {

        int low = 0;
        int high = height.length - 1;
        int res = 0;
        while(low < high){
            if (height[low]<=height[high]){
                res = Math.max(res,(high-low)*height[low]);
                low++;
            }else {
                res = Math.max(res,(high-low)*height[high]);
                high--;
            }
        }
        return res;

    }

    @Test
    public void test() {
        // 测试代码
        int i = maxArea(new int[]{1,1});
        System.out.println(i);

    }

}
